import { createRouter, createWebHashHistory } from 'vue-router'
import Login from '../views/login/Login.vue'
import Layout from '../views/layout/Layout.vue'
import OrderDetail from '../views/order/Check.vue'
import OrderEdit from '../views/order/Edit.vue'

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        component: Login
    },
    //   首页模块
    {
        path: '/layout',
        component: Layout,
        redirect: '/home',
        children: [
            {
                path: '/home',
                component: () => import('../views/home/Home.vue')
            },

        ]
    },
    //   账号模块
    {
        path: '/account',
        component: Layout,
        redirect: '/accountList',
        children: [
            {
                path: '/accountList',
                component: () => import('../views/account/List.vue')
            },
            {
                path: '/accountAdd',
                component: () => import('../views/account/Add.vue')
            },
            {
                path: '/accountCenter',
                component: () => import('../views/account/Center.vue')
            },
            {
                path: '/accountEdit',
                component: () => import('../views/account/Edit.vue')
            },

        ]
    },
    //   商品模块
    {
        path: '/goods',
        component: Layout,
        redirect: '/goodsList',
        children: [
            {
                path: '/goodsList',
                component: () => import('../views/goods/List.vue')
            },
            {
                path: '/goodsAdd',
                component: () => import('../views/goods/Add.vue')
            },
            {
                path: '/goodsType',
                component: () => import('../views/goods/Type.vue')
            },
            {
                path: '/goodsEdit',
                name: 'GoodsEdit',
                component: () => import('../views/goods/Edit.vue')
              }


        ]
    },
    //   订单模块
    {
        path: '/order',
        component: Layout,
        redirect: '/orderList',
        children: [
            {
                path: '/orderList',
                component: () => import('../views/order/Order.vue')
            },
            {
                path: '/orderDetail/:id',
                name: 'OrderDetail',
                component: ()=>import('../views/order/Check.vue')
            },
            {
                path: '/orderEdit/:id',
                name: 'OrderEdit',
                component: ()=>import('../views/order/Edit.vue')
            }
        ]
    },
    //   店铺模块
    {
        path: '/shop',
        component: Layout,
        redirect: '/shopInfo',
        children: [
            {
                path: '/shopInfo',
                component: () => import('../views/shop/Shop.vue')
            },
        ]
    },
    //   统计模块
    {
        path: '/statistics',
        component: Layout,
        redirect: '/statisticsGoods',
        children: [
            {
                path: '/statisticsGoods',
                component: () => import('../views/statistics/Goods.vue')
            },
            {
                path: '/statisticsOrder',
                component: () => import('../views/statistics/Order.vue')
            }

        ]
    },

]
const router = createRouter({
    history: createWebHashHistory(),
    routes
})
export default router